#include "pch.h"
#include "GaojieDriveApp.h"
#include "AppConfig.h"
#include "UIWndManager.h"
#include "CloudManager.h"
#include "PluginManager.h"
#include "..\FileTransfer\FileTransfer.h"

CGaojieDriveApp::CGaojieDriveApp(HINSTANCE hInstance)
	: m_hInstance(hInstance)
	, m_pAppConfig(std::make_unique<CAppConfig>())
	, m_pUIWndManager(std::make_unique<CUIWndManager>())
	, m_pCloudManager(std::make_unique<CCloudManager>())
	, m_pPluginManager(std::make_unique<CPluginManager>())
{
	AssertInUIThread();
}

CGaojieDriveApp::~CGaojieDriveApp()
{
	AssertInUIThread();
}

bool CGaojieDriveApp::Init(LPCWSTR lpCmdLine)
{
	AssertInUIThread();

	return GetAppConfig()->Init() &&
		AT::GetAsyncTask()->Init() &&
		FT::GetFileTransfer()->Init() &&
		GetPluginManager()->Init() &&
		GetCloudManager()->Init() &&
		GetUIWndManager()->Init();
}

void CGaojieDriveApp::Exit()
{
	AssertInUIThread();

	FT::GetFileTransfer()->Exit();
	AT::GetAsyncTask()->Exit();
	GetCloudManager()->Exit();
	GetPluginManager()->Exit();
	GetUIWndManager()->Exit();
	GetAppConfig()->Exit();
}
